﻿using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace WallCreateAndEdit.WallModule
{
	public partial class DlgChangeWallThick : System.Windows.Forms.Form
	{
		public DlgChangeWallThick()
		{
			this.InitializeComponent();
		}

		public DlgChangeWallThick(ExternalCommandData cmdData, ref string message, ElementSet elements, Wall refWall)
		{
			this.InitializeComponent();
			this.m_cmdData = cmdData;
			this.m_msg = message;
			this.m_elements = elements;
			this.m_refWall = refWall;
		}

		private void btnView_Click(object sender, EventArgs e)
		{
			base.Enabled = false;
			new CmdShowSameWalls
			{
				m_refWall = this.m_refWall
			}.Execute(this.m_cmdData, ref this.m_msg, this.m_elements);
			base.Enabled = true;
		}

		private void btnOK_Click(object sender, EventArgs e)
		{
			this.m_dNewThick = Convert.ToDouble(this.tbNewThick.Text);
			new CmdSetNewThick
			{
				m_dNewThick = this.m_dNewThick,
				m_refWall = this.m_refWall
			}.Execute(this.m_cmdData, ref this.m_msg, this.m_elements);
		}

		private void DlgChangeWallThick_Load(object sender, EventArgs e)
		{
			this.tbNewThick.Text = this.m_dNewThick.ToString();
		}

		private void btnCancel_Click(object sender, EventArgs e)
		{
			base.Close();
		}

		public double m_dNewThick;

		private ExternalCommandData m_cmdData;

		private string m_msg;

		private ElementSet m_elements;

		private Wall m_refWall;
	}
}
